Typesetting {\tenbxsl APL\/} Objects

Typing the name of an occasional APL symbol within a normal text is not a real nuisance to the author of APL texts. But typesetting a larger piece of APL code certainly is. Imagine a function named , which implements a recursive tree traversal algorithm:


\begin{APLfns}
\begin{APLfnsline}{}{\APLdel}
\APLZ\APLleftarrow\APLC\APLL\APLA\A...
...Lzero
\end{APLfnsline}\begin{APLfnsline}{}{\APLdel}
\end{APLfnsline}\end{APLfns}

In order to print just the beginning of the header of the function, you would have to type:

\APLspace\APLspace\APLspace\APLspace%
\APLspace\APLdel\APLZ%
\APLleftarrow\APLC\APLL\APLA\APLS\APLS%
\protect\APLunderbar\APLL%
\APLI\APLS\APLT\APLspace\protect\APLdelta%
\APLT\APLR\APLE\APLE%
\APLbr\APLspace\APLR\APLO\APLO\APLT\APLbr%

Obtaining the familiar function layout used in APL textbooks would require additional code. What is more, besides being awkward the whole process is error-prone: Almost certainly it will result in a printout different from the APL code.

Therefore we strongly recommend automatic translation of APL code. We provide an APL front end which transforms APL objects into logical document elements which can be \input into LATEX documents. This guarantees consonance between the original APL code and its listing and is also more convenient.

For all APL language elements we have defined APL functions and corresponding LATEX environments. Our system supports the typesetting of:

Apart from minor modifications we have used traditional layout conventions for all language elements. For example, the convention that user input is six spaces indented can be traced back to the very first implementation of APL. An other traditional convention states that if a line of APL code does not fit on a single line of the display, the rest of the code is wrapped around and continues on the next line. In some functions this rule may lead to line breaks in the middle of names. Since APL identifiers can be up to 255 characters long line breaking within names cannot be avoided in general.

As you can see, arrays and functions can be typeset in various ways. For example, the above listing of the APL function was printed by the following APL expression:


\begin{APLbold}\begin{APLexpr}
\APLquote\APLT\APLR\APLE\APLE\APLquote\APLspace\A...
...Lquote\protect\APLdelta\APLT\APLR\APLE
\APLE\APLquote
\end{APLexpr}\end{APLbold}

The APL function produces the file tree.tex as output. The APL front end not only maps each character into the corresponding TEX macro but it also produces the line numbers in brackets and the surrounding LATEX environments in order to guarantee uniform display of functions throughout the document.

In the following we present examples for each of the cases mentioned above. At the same time, the examples give us the opportunity to demonstrate variations of type style and size.



Subsections